﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B13_Ex03_David_300512340_Alexey_321203689
{
    /// <summary>
    /// Pattern: Static Factory Class.
    /// </summary>
    public static class SearchFactory
    {
        public static ISearchPost Create(bool i_SearchByWord, bool i_SearchByDate)
        {
            ISearchPost searchMethod = null;

            if (i_SearchByWord && !i_SearchByDate)
            {
                searchMethod = new SearchPostByWord();   
            }

            if (!i_SearchByWord && i_SearchByDate)
            {
                searchMethod = new SearchPostByDate();
            }

            if (i_SearchByWord && i_SearchByDate)
            {
                searchMethod = new SearchPostByWordAndDate();
            }

            return searchMethod;
        }
    }
}
